package modler

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(30)" json:"username"`
	Email    string `gorm:"type:varchar(30)" json:"email"`
	Password string `gorm:"type:varchar(255)" json:"password"`
}
type Video struct {
	gorm.Model
	Title           string `gorm:"type:varchar(30)" json:"title"`
	Comment         string `gorm:"type:text" json:"comment"`
	Img             string `gorm:"type:varchar(255)" json:"img"`
	LikeCount       int    `gorm:"type:int" json:"like_count"`
	CollectionCount int    `gorm:"type:int" json:"collection_count"`
	UserID          int    `gorm:"type:int" json:"user_id"`
	User            User   `gorm:"foreignKey:UserID" json:"user"`
}

// 点赞

type Like struct {
	gorm.Model
	UserID  int   `gorm:"type:int" json:"user_id"`
	User    User  `gorm:"foreignKey:UserID" json:"user"`
	VideoID int   `gorm:"type:int" json:"video_id"`
	Video   Video `gorm:"foreignKey:VideoID" json:"video"`
}

//关注

type Collection struct {
	gorm.Model
	UserID  int   `gorm:"type:int" json:"user_id"`
	User    User  `gorm:"foreignKey:UserID" json:"user"`
	VideoID int   `gorm:"type:int" json:"video_id"`
	Video   Video `gorm:"foreignKey:VideoID" json:"video"`
}
